<?php
namespace app\home\controller;
use cmf\controller\UserBaseController;
use think\Db;

class OftenController extends UserBaseController
{
    //查看流水应该是分权限的，暂时没有加
    function _initialize()
    {
        parent::_initialize();
    }
    public function index()
    {
        //店铺营业额时时统计（不存表）
        $uinfo=cmf_get_current_user();//登录人详情
        $con=array();
        $con['storeid']=$uinfo['store_id'];       
        $today_time=strtotime('today'); //今天0点时间
        $con['ctime']=array('gt',$today_time);
        $con['payStatus']=1;
//         if($uinfo['role_type'] ==6 ){//收银员
//             $con['operatorid']=$uinfo['id'];
//         }
        //$totalMoney='';
        $totalMoney=Db::name('Order')->where($con)->sum('totalMoney');//销售金额
        $actualMoney=Db::name('Order')->where($con)->sum('actualMoney');//实收金额
        $getMoney=Db::name('Order')->where($con)->sum('getMoney');//付款金额
        $giveChange=Db::name('Order')->where($con)->sum('giveChange');//找零金额
        $discount=Db::name('Order')->where($con)->sum('discount');//优惠金额
        $this->assign("totalMoney", $totalMoney);
        $this->assign("actualMoney", $actualMoney);
        $this->assign("getMoney", $getMoney);
        $this->assign("giveChange", $giveChange);
        $this->assign("discount", $discount);
        $this->assign("ctime", time());
        $this->assign("uinfo", $uinfo);
        return $this->fetch();
    }
}